<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
?>
<div id="steps" class="form complex">
	<?
    //Setting Awal Value Jika Prosedur yang dilakukan adalah prosedur input biasa.
	
	$value = array(
		'username'				=> "",
		'role'					=> "",
		'lisensi'					=> "",
		'legend'				=> "Form Input User",
		'info'					=> "Form pendaftaran user",
		'act_form'				=> "user/user_management/input_user/"
	);
	
	//Setting Value pada form Jika melakukan prosedur Edit terhadap data tertentu.
	if($status == "edit"){
		foreach($user_man->result() as $row){
			$value['id_user'] = $row->ID_USER;
			$value['username'] = $row->USERNAME;
			$value['role'] = $row->ID_PRIVILAGE;
		}
		$value['legend'] = "Form Edit User";
		$value['info'] = "Form edit data pendaftaran user";
		$value['act_form'] = "user/user_management/edit_user/".$value['id_user'];
	}//end if
	
	?>
	<?= form_open($value["act_form"]); ?>
	
		
 <!-- Konten -------------------------------------------------------------------------->
<fieldset class="step">
		
		<p>
			<label class="desc">Username*</label>
			<div>
				<input class="field text large" type="text" maxlength="20" size="2" name="username" value="<? if(set_value('username')!='') echo set_value('username'); else echo $value['username'];?>"/> 
			</div>
		</p>
		<?php echo form_error('username'); ?>
		
		<p>
			<label class="desc">Password *</label>
			<div>
				<input class="field text medium" type="password" maxlength="100" size="3" name="password" value="<? if(set_value('password')!='') echo set_value('password');?>"/> 
			</div>		
		</p>
		<?php echo form_error('password'); ?>
		
		<p>
			<label class="desc">Ulangi Password *</label>
			<div>
				<input class="field text medium" type="password" maxlength="100" size="3" name="repasswordbaru" value=""/> 
			</div>		
		</p>
		
			
			
			<p>
				<label class="desc">Privilage User *</label>
					<div>
							<? 
							//list role user
						//$options_role[''] = "-- Pilih Privilage User --";
						foreach($roleoptions->result() as $role){
							$options_role[$role->ID_PRIVILAGE] = $role->PRIVILAGE;
						}
							echo form_dropdown('role',$options_role,$value["role"],'class="field select"');	
							?>
					</div>
			</p>
			<?php echo form_error('role'); ?>



			<p>
				<label class="desc">Lisensi</label>
					<div>
							<? 
							//list role user
						$options_lisensi[''] = "-- Pilih Lisensi --";
						foreach($lisensi->result() as $row){
							$options_lisensi[$row->ID_LISENSI] = $row->NAMA_LISENSI;
						}
							echo form_dropdown('lisensi',$options_lisensi,$value["lisensi"],'class="field select"');	
							?>
					</div>
				
			</p>
			<?php echo form_error('role'); ?>				
        
        		
		<p class="submit">
			<button id="registerButton" type="submit">Simpan</button>&nbsp;
			<button id="registerButton" TYPE="BUTTON" VALUE="Back" ONCLICK="window.location.href='<?=base_url()?>index.php/user/user_management'">Kembali</button>
		</p>
</fieldset>
<?= form_close(); ?>
</form>
</div><!--container-->